/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay.component;

import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnDismissListener;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.pay.res.b;

public enum e {
a;

private c b;
private a c;
private b d;

public e a(Context paramContext, CharSequence paramCharSequence) {
    return a(paramContext, paramCharSequence, false);
}

public e a(Context paramContext, CharSequence paramCharSequence, boolean paramBoolean) {
    a(this.d);
    this.b = new c(paramContext);
    this.b.d(65281);
    this.b.setOnCancelListener(new DialogInterface.OnCancelListener() {
        public void onCancel(DialogInterface paramDialogInterface) {
            if (e.a(e.this) == null)
                return;
            e.a(e.this).a(true);
        }
    });
    this.b.setOnDismissListener(new DialogInterface.OnDismissListener() {
        public void onDismiss(DialogInterface paramDialogInterface) {
            if (e.a(e.this) == null)
                return;
            e.a(e.this).a(false);
        }
    });
    if (this.c == null)
        this.c = new a(null);
    this.b.a(false);
    this.b.setCancelable(paramBoolean);
    this.b.b(0);
    this.b.a(this.c.a(paramContext), -2, -2);
    this.b.show();
    this.c.a(paramCharSequence);
    return a;
}

public final boolean a() {
    return ((this.b != null) && (this.b.isShowing()));
}

public void b() {
    a(false);
}

public void a(boolean paramBoolean) {
    a((paramBoolean) ? this.d : null);
}

public void a(b paramb) {
    if (!(a()))
        return;
    this.d = paramb;
    this.c.a();
    this.b.dismiss();
    this.b = null;
}

private class a {
    private ImageView b;
    private TextView c;
    private b d;
    private LinearLayout e;

    public View a(Context paramContext) {
        if (this.e == null) {
            b(paramContext);
            paramContext = null;
        }
        else {
            ViewParent localViewParent = this.e.getParent();
            if (localViewParent instanceof ViewGroup)
                ((ViewGroup) localViewParent).removeView(this.e);
        }
        return this.e;
    }

    private void b(Context paramContext) {
        this.e = new LinearLayout(paramContext);
        this.d = b.a(paramContext);
        this.e.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
        this.e.setGravity(17);
        this.e.setMinimumWidth(s.b(paramContext, 300.0F));
        this.e.setMinimumHeight(s.b(paramContext, 90.0F));
        this.d.a(this.e, -1073741725);
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(s.b(paramContext, 25.0F), s.b(
                paramContext, 25.0F));
        localLayoutParams.rightMargin = s.b(paramContext, 8.0F);
        this.b = new ImageView(paramContext);
        this.b.setLayoutParams(localLayoutParams);
        this.e.addView(this.b);
        this.c = new TextView(paramContext);
        this.c.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
        this.c.setTextColor(-16777216);
        this.c.setTextSize(1, s.a(paramContext, 13.3F));
        this.e.addView(this.c);
    }

    private void a(ImageView paramImageView) {
        this.d.a(paramImageView, 1073741920);
        RotateAnimation localRotateAnimation = new RotateAnimation(0.0F, 360.0F, 1, 0.5F, 1, 0.5F);
        localRotateAnimation.setRepeatCount(-1);
        localRotateAnimation.setDuration(1000L);
        localRotateAnimation.setInterpolator(new LinearInterpolator());
        paramImageView.setAnimation(localRotateAnimation);
    }

    public void a(CharSequence paramCharSequence) {
        if (this.c != null)
            this.c.setText(paramCharSequence);
        if (this.b == null)
            return;
        a(this.b);
    }

    public void a() {
        if (this.b == null)
            return;
        if (this.b.getAnimation() != null)
            this.b.getAnimation().reset();
        this.b.clearAnimation();
    }
}

public static abstract interface b {
    public abstract void a(boolean paramBoolean);
}
}